package edge;

import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.0.0)",
    comments = "Source: edge.proto")
public class DeviceGrpc {

  private DeviceGrpc() {}

  public static final String SERVICE_NAME = "edge.Device";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<edge.EdgeMessage.RequestData,
      edge.EdgeMessage.Result> METHOD_DEVICE_SERVICE =
      io.grpc.MethodDescriptor.create(
          io.grpc.MethodDescriptor.MethodType.UNARY,
          generateFullMethodName(
              "edge.Device", "DeviceService"),
          io.grpc.protobuf.ProtoUtils.marshaller(edge.EdgeMessage.RequestData.getDefaultInstance()),
          io.grpc.protobuf.ProtoUtils.marshaller(edge.EdgeMessage.Result.getDefaultInstance()));

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static DeviceStub newStub(io.grpc.Channel channel) {
    return new DeviceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static DeviceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new DeviceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
   */
  public static DeviceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new DeviceFutureStub(channel);
  }

  /**
   */
  public static abstract class DeviceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * 接收边节点的数据方法
     * </pre>
     */
    public void deviceService(edge.EdgeMessage.RequestData request,
        io.grpc.stub.StreamObserver<edge.EdgeMessage.Result> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_DEVICE_SERVICE, responseObserver);
    }

    @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_DEVICE_SERVICE,
            asyncUnaryCall(
              new MethodHandlers<
                edge.EdgeMessage.RequestData,
                edge.EdgeMessage.Result>(
                  this, METHODID_DEVICE_SERVICE)))
          .build();
    }
  }

  /**
   */
  public static final class DeviceStub extends io.grpc.stub.AbstractStub<DeviceStub> {
    private DeviceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceStub(channel, callOptions);
    }

    /**
     * <pre>
     * 接收边节点的数据方法
     * </pre>
     */
    public void deviceService(edge.EdgeMessage.RequestData request,
        io.grpc.stub.StreamObserver<edge.EdgeMessage.Result> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_DEVICE_SERVICE, getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class DeviceBlockingStub extends io.grpc.stub.AbstractStub<DeviceBlockingStub> {
    private DeviceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * 接收边节点的数据方法
     * </pre>
     */
    public edge.EdgeMessage.Result deviceService(edge.EdgeMessage.RequestData request) {
      return blockingUnaryCall(
          getChannel(), METHOD_DEVICE_SERVICE, getCallOptions(), request);
    }
  }

  /**
   */
  public static final class DeviceFutureStub extends io.grpc.stub.AbstractStub<DeviceFutureStub> {
    private DeviceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private DeviceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected DeviceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new DeviceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * 接收边节点的数据方法
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<edge.EdgeMessage.Result> deviceService(
        edge.EdgeMessage.RequestData request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_DEVICE_SERVICE, getCallOptions()), request);
    }
  }

  private static final int METHODID_DEVICE_SERVICE = 0;

  private static class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final DeviceImplBase serviceImpl;
    private final int methodId;

    public MethodHandlers(DeviceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_DEVICE_SERVICE:
          serviceImpl.deviceService((edge.EdgeMessage.RequestData) request,
              (io.grpc.stub.StreamObserver<edge.EdgeMessage.Result>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    return new io.grpc.ServiceDescriptor(SERVICE_NAME,
        METHOD_DEVICE_SERVICE);
  }

}
